package com.hyt.it.ogt.kq.service.bm.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hyt.it.ogt.cj.model.vo.OptionTree;
import com.hyt.it.ogt.kq.service.bm.model.entity.UserPermission;
import com.hyt.it.ogt.kq.service.bm.model.vo.ProjectParam;
import com.hyt.it.ogt.kq.service.bm.model.vo.StudentStatVo;
import com.hyt.it.ogt.kq.service.bm.model.vo.UserPermissionInfo;
import com.hyt.it.ogt.kq.service.bm.model.vo.UserPermissionVo;
import com.hyt.model.PageParam;

import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * <p>
 * 服务类
 * </p>
 *
 * @author liteng
 * @since 2021-03-01
 */
public interface IUserPermissionService extends IService<UserPermission> {

    void saveUserPermission(UserPermissionVo vo) throws Exception;

    List<OptionTree> loadPermissionByUserId(String projectId);

    List<String> queryPermissionByUserId(String projectId, String userId);

    IPage<UserPermissionInfo> queryPermissionPage(PageParam<UserPermissionInfo> pageParam, String projectId, List<String> userIds, List<String> areaCodes);

    void deleteUserPermission(String projectId, String userId) throws Exception;

    void copyUserPermission(String oldProjectId, String newProjectId) throws Exception;

    Map<String, List<String>> getProjectPermission(String userId);

    /**
     * 获取报名的权限
     *
     * @param userId     用户ID
     * @param projectIds 报名集合
     * @return
     */
    Map<String, List<String>> getProjectPermission(String userId, List<String> projectIds);


    /**
     * 查询项目是不是需要校验区域权限
     *
     * @param projectId
     * @return
     */
    boolean needCheckAreaPermission(String projectId);

    /**
     * 查询项目是不是需要校验机构权限
     *
     * @param projectId
     * @return
     */
    boolean needCheckOfficePermission(String projectId);

    int statStudent(String userId, Set<String> deptIds, String startTime, String endTime);

    List<StudentStatVo> statStudentByHour(ProjectParam param);

    List<StudentStatVo> statStudentByDate(ProjectParam param);

    /**
     * 获取报名项目下的所有权限用户
     *
     * @param projectId 报名ID
     * @return
     */
    List<String> listProjectUserId(String projectId);
}
